package com.xs.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xs.entity.Collection;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface CollectionDao extends BaseMapper<Collection> {

    @Delete("delete FROM collection where article_id=#{articleId} and uid=#{uid} ")
    void removeByUdAndArticleId(@Param("articleId") Integer articleid, @Param("uid") Integer uid );

    @Select("select article_id from collection where uid = #{uid}")
    List<Integer> getarticleIdonByUid(@Param("uid")  Integer uid);
}
